package com.zyl.blog.common.validated;

import com.zyl.blog.common.config.anno.SiteType;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * @version v1.0
 * @ProjectName: Personal_Blog
 * @Package: com.zyl.common.validated
 * @ClassName: SiteTypeValidator
 * @Description:
 * @Author FinalFantasy
 * @Date 2025/3/11-19:20
 */
public class SiteTypeValidator implements ConstraintValidator<SiteType, Integer> {
    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
        if(value == null) {
            return false;
        }
        return value.equals(0) || value.equals(1) || value.equals(2) || value.equals(3); // 0123 校验
    }
}
